"""Rename encrypted_key column to key and make encrypted_key and key_hmac not nullable

Revision ID: 7ecafab6f8f9
Revises: 0846452f51ac
Create Date: 2025-04-15 09:32:55.974507+00:00

"""
from typing import Sequence, Union

from alembic import op

# revision identifiers, used by Alembic.
revision: str = '7ecafab6f8f9'
down_revision: Union[str, None] = '0846452f51ac'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('api_keys', 'encrypted_key', new_column_name='key', nullable=False)
    op.alter_column('api_keys', 'key_hmac',  nullable=False)

    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('api_keys', 'key', new_column_name='encrypted_key', nullable=True)
    op.alter_column('api_keys', 'key_hmac', nullable=True)
    # ### end Alembic commands ###
